package com.gooluke.user.exception;

import com.gooluke.common.domain.Result;
import com.gooluke.common.exception.BizException;
import com.gooluke.user.enums.UserException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(BizException.class)
    public Result<Object> handleBizException(BizException ex) {
        return Result.error(UserException.BUSINESS.getCode(), ex.getMessage());
    }
}